package com.liaozibo.demo.seckill.support.service.impl;

import com.liaozibo.demo.seckill.support.dao.mapper.ProductMapper;
import com.liaozibo.demo.seckill.support.dao.model.ProductDO;
import com.liaozibo.demo.seckill.support.export.dto.ProductDTO;
import com.liaozibo.demo.seckill.support.export.dto.Result;
import com.liaozibo.demo.seckill.support.service.ProductService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public ProductDTO getProductByCode(String code) {
        ProductDO productDO = productMapper.selectByCode(code);
        ProductDTO productDTO = new ProductDTO();
        BeanUtils.copyProperties(productDO, productDTO);
        return productDTO;
    }
}
